package com.course.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * <p>
 * 后台用户权限表(访问资源页面功能标识，API接口等)
 * </p>
 *
 * @author author
 * @since 2022-09-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("permission")
public class Permission implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    /**
     * 父级权限id
     */
    @TableField("pid")
    private Long pid;

    /**
     * 名称
     */
    @TableField("name")
    private String name;

    /**
     * 权限值
     */
    @TableField("value")
    private String value;


    /**
     * 权限类型：0->目录；1->菜单；2->按钮（接口绑定权限）
     */
    @TableField("type")
    private Integer type;

    /**
     * 前端资源路径
     */
    @JsonIgnore
    @ToString.Exclude
    @TableField("uri")
    private String uri;

    /**
     * 启用状态；0->禁用；1->启用
     */
    @TableField("status")
    private Integer status;

    /**
     * 前端组件名称
     */
    @TableField("component")
    private String component;

    /**
     * 排序
     */
    @TableField("sort")
    private Integer sort;

    @JsonIgnore
    @ToString.Exclude
    @TableField(value = "meta")
    private String metaJson;

    @TableField(exist = false)
    private List<Permission> children = new ArrayList<>();

    @TableField(exist = false)
    private JSONObject meta;

    @TableField(exist = false)
    private String path;

}
